package hamaster.jpbc.crypt.rc4;

import hamaster.jpbc.pbc.PBCDriver;

public final class SimpleRC4Crypter {

	public static String encrypt(String plain, String key) {
		RC4 rc4 = new RC4();
		byte[] cs = rc4.rc4(plain.getBytes(), key.getBytes());
		return PBCDriver.hex(cs);
	}

	public static String decrypt(String cipher, String key) {
		RC4 rc4 = new RC4();
		byte[] raw = PBCDriver.unhex(cipher);
		return new String(rc4.rc4(raw, key.getBytes()));
	}

}
